From: Dan Winship Date: Thu, 6 Jan 2011 18:38:41 +0000 (-0500) Subject: altTab: fix destroy-without-showing case X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9323 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a46baeed0b51991d3bcaf0924c80dd6dfe5756ab;p=gnome-shell.git altTab: fix destroy-without-showing case If the switcher is destroyed without ever being fully shown (either because it couldn't get a keyboard grab, or just because there are no apps to display), destroy it immediately rather than tweening it towards destruction, since its contents haven't been built yet and _allocate() will throw errors if it runs. --- diff --git a/js/ui/altTab.js b/js/ui/altTab.js index ca2b902be..b117fc840 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -34,7 +34,8 @@ function AltTabPopup() { AltTabPopup.prototype = { _init : function() { this.actor = new Shell.GenericContainer({ name: 'altTabPopup', - reactive: true }); + reactive: true, + visible: false }); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); @@ -365,15 +366,18 @@ AltTabPopup.prototype = { }, destroy : function() { - Tweener.addTween(this.actor, - { opacity: 0, - time: POPUP_FADE_TIME, - transition: 'easeOutQuad', - onComplete: Lang.bind(this, - function() { - this.actor.destroy(); - }) - }); + if (this.actor.visible) { + Tweener.addTween(this.actor, + { opacity: 0, + time: POPUP_FADE_TIME, + transition: 'easeOutQuad', + onComplete: Lang.bind(this, + function() { + this.actor.destroy(); + }) + }); + } else + this.actor.destroy(); }, _onDestroy : function() {